import 'package:built_collection/built_collection.dart';
import 'package:equatable/equatable.dart';
import 'package:backend.core/core/domain/entities/api/app_store/api_app_store_purchased_item.dart';
import 'package:backend.core/core/domain/entities/api/app_store/api_app_store_purchased_subscription_expiration_reason.dart';
import 'package:backend.core/core/domain/entities/api/app_store/api_app_store_purchased_subscription_price_increase_status.dart';
import 'package:backend.core/core/domain/entities/api/app_store/api_app_store_purchased_subscription_status.dart';
import 'package:backend.core/core/domain/entities/api/app_store/api_app_store_purchased_subscription_transaction.dart';

class ApiAppStorePurchasedSubscription extends Equatable implements ApiAppStorePurchasedItem {
  const ApiAppStorePurchasedSubscription({
    required this.purchaseItemSku,
    required this.test,
    required this.originalTransactionId,
    required this.autoRenewalEnabled,
    required this.status,
    required this.priceIncreaseStatus,
    required this.expirationReason,
    required this.gracePeriodExpirationTime,
    required this.expirationTime,
    required this.transactions,
  });

  @override
  final String purchaseItemSku;

  @override
  final bool test;

  final String originalTransactionId;
  final bool autoRenewalEnabled;
  final ApiAppStorePurchasedSubscriptionStatus status;
  final ApiAppStorePurchasedSubscriptionPriceIncreaseStatus priceIncreaseStatus;
  final ApiAppStorePurchasedSubscriptionExpirationReason? expirationReason;
  final DateTime? gracePeriodExpirationTime;
  final DateTime? expirationTime;
  final BuiltList<ApiAppStorePurchasedSubscriptionTransaction> transactions;

  @override
  List<Object?> get props {
    return [
      purchaseItemSku,
      test,
      originalTransactionId,
      autoRenewalEnabled,
      status,
      priceIncreaseStatus,
      expirationReason,
      gracePeriodExpirationTime,
      expirationTime,
      transactions,
    ];
  }
}
